<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
				list-style: none;
			}
			.web{
				width: 300px;
				height: 300px;
				border: 2px solid #000;
				margin: 200px auto;
			}
			ul{
				overflow: hidden;
			}
			li{
				float: left;
				width: 100px;
				box-sizing: border-box;
				border: 1px solid #000;
				cursor: pointer;
				text-align: center;
			}
			li:active{
				background: gainsboro;
			}
			.content{
				width: 100%;
				height: 100%;
				position: relative;
			}
			.content div{
				position: absolute;
				top: 0;
				left: 0;
				display: none;
			}
			.content div:nth-child(1){
				display: block;
			}
		</style>
	</head>
	<body>
		<div class="web">
			<ul>
				<li>html</li>
				<li>css</li>
				<li>JavaScript</li>
			</ul>
			<div class="content">
				<div>html是超文本标记语言</div>
				<div>css是超文本标记语言</div>
				<div>JavaScript是超文本标记语言</div>
			</div>
		</div>
		<script type="text/javascript">
			var aLi = document.querySelectorAll("li");
			var aCont = document.querySelectorAll(".content div");
			var leng = aLi.length;
			for(var i=0;i<leng;i++){
				(function(k){
					aLi[k].addEventListener("click",function(){
						var leng = aCont.length;
						for(var j=0;j<leng;j++){
							aCont[j].style.display = "none";
						}
						aCont[k].style.display = "block";
					})
				})(i)
			}
			
			
		</script>
	</body>
</html>
